package com.rui.shangXueTang.linked;

/**
 * @author : [锐神NO.3]
 * @version : [v1.0]
 * @className : LinkedTest
 * @createTime : [2022/2/13 21:33]
 * @description : [描述该类的功能]
 */

public class LinkedTest {
    public static void main(String[] args) {
        GoodsNode goodsNode1 = new GoodsNode(1, "耐克运动鞋", 599.00);
        GoodsNode goodsNode2 = new GoodsNode(2, "耐克上衣", 399.00);
        GoodsNode goodsNode3 = new GoodsNode(3,"阿迪达斯运动鞋",699.00);
        GoodsNode goodsNode4 = new GoodsNode(4,"李宁运动鞋",499.00);

        OddLinkedList oddLinkedList = new OddLinkedList();

        //按顺序插入
        oddLinkedList.add(goodsNode1);
        oddLinkedList.add(goodsNode2);
        oddLinkedList.add(goodsNode3);
        oddLinkedList.add(goodsNode4);

        oddLinkedList.list();

        System.out.println("-----------------");

        //按id值插入
        oddLinkedList.addById(goodsNode3);
        oddLinkedList.addById(goodsNode2);
        oddLinkedList.addById(goodsNode4);
        oddLinkedList.addById(goodsNode1);

        oddLinkedList.list();
        int count = oddLinkedList.getCount();
        System.out.println(count);
    }
}
